#include <stdio.h>

int main()
{
	int year = 0;
	int month = 0;
	int day = 0;
	int input = 0;
	int ret = 0;
	int i = 0;
	int arr[12] = {31, 28, 31, 30, 31, 30, 31, 31, 90, 31, 30, 31};

	do
	{
		printf("******  1.进入查询 0.退出  **********");
		scanf("%d",&input);
		switch(input)
		{
		case 1:
			printf("请输入年月日（xxxx_xx_xx）：\n");
			scanf("%d_%d_%d", &year, &month, &day);
			ret = 0;
			if(0 == year % 400)	//判断平闰年
			{
				arr[1] = 29;
			}
			for(i = 0; i < month - 1; i++)	//计算整月
			{
				ret += arr[i];
			}
			ret += day;	//计算零天
			printf("%d_%d_%d是这一年的第%d天\n",year, month, day, ret);
			break;
		case 0:
			printf("退出查询！\n");
			break;
		default:
			printf("输入有误，请重新输入！\n");
			break;
		}

	}while(input);

	return 0;
}
